import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/Table';
import { rules } from '@pkg/utils';
import { render } from '@apps/antd-admin/src/hooks/render/renderUtils';
import { RenderType } from '@pkg/setting';
import {Api} from "./project.api";

export const columns: BasicColumn[] = [

  {
    title: '标题',
    dataIndex: 'projectName',
    width: 130,
  },
  {
    title: '价格',
    dataIndex: 'projectPrice',
    width: 130,
  },
  {
    title: '所属模块',
    dataIndex: 'projectGroup',
    dictData: [
      { label: '秒查', value: "1"},
      { label: '惠查', value: "2"},
      { label: '精查', value: "3" },
      { label: '秒查，惠查', value: "1,2" },
      { label: '惠查，精查', value: "2,3" },
      { label: '秒查，惠查，精查', value: "1,2,3" },
    ],
    renderType: RenderType.DICT,
    width: 80,
  },
  {
    title: '发布状态',
    dataIndex: 'projectState',
    width: 80,
    rowKey: 'projectId',
    renderApi: Api.setSendStatus,
    actionAuth:'ACTION_project_state',
    customRender: render.renderSwitch,
  },
  {
    title: '创建日期',
    dataIndex: 'createTime',
    width: 80,
    sorter: {
      multiple: 2,
    },
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'projectName',
    label: '标题',
    component: 'Input',
    colProps: { span: 4 },
  },

];

export const formSchema: FormSchema[] = [
  {
    label: '标题',
    field: 'projectName',
    component: 'Input',
    required: true,
  },
  {
    label: '价格',
    field: 'projectPrice',
    component: 'InputNumber',
    required: true,
  },
  {
    field: 'projectGroup',
    label: '类别',
    component: 'CheckboxGroup',
    componentProps: {
      options: [
        { label: '秒查', value: "1" },
        { label: '惠查', value: "2" },
        { label: '精查', value: "3" },
      ],
    },
  },
];
